Java Mail Interview Questions and Answers
Question: What is Session in JavaMail api?Answer: Session is the top-level entry class representing mail session. It uses java.util.Properties object to get information about mail server, username, password etc. This class has a private constructor and you can get session objects through getInstance() and getDefaultInstance() methods. getDefaultInstance() method provides default Session object which takes Properties and Authenticator objects as arguments.Properties props = new Properties(); Session session = Session.getDefaultInstance(props, null); Or create a unique session by getInstance() method… Properties props = new Properties(); Session session = Session.getInstance(props, null); |
Is it helpful?
Yes
No
Most helpful rated by users:
- What is JavaMail?
- Explain POP, SMTP and IMAP protocols.
- Discuss about JavaMail.
- Explain the structure of Javamail API
- What are the advantages of JavaMail?